<?php
namespace App\Modules\Goods;

use App\Modules\AdapterApi;
use App\Services\Goods\GoodsIndex;


/**
 * Class User 商品 应用层
 * @package App\Modules\Goods
 */
class Goods extends AdapterApi{

    /*艺货后台发布积分商品*/
    public function addIntegralGoods(): array 
    {
        $data = pick_array($this->postData, ['cate_id', 'title', 'integral', 'profile_pic', 'imgs_urls', 'imgs_ids', 'origin_number', 'order', 'desc', 'token']);
        return GoodsIndex::Goods()->addIntegralGoods($data);
    }

    /*后台修改积分商品*/
    public function updateIntegralGoods(): array
    {
        $data = pick_array($this->postData, ['id', 'cate_id', 'title', 'integral', 'profile_pic', 'imgs_urls', 'imgs_ids', 'number', 'origin_number', 'order', 'desc', 'token']);
        return GoodsIndex::Goods()->updateIntegralGoods($data);
    }

//    /*艺货后台获取积分商品分页列表*/
//    public function allGoodsList(): array
//    {
//        $data = $this->haveIssetReceiveData(['keywords'=>'', 'page'=>1, 'listRows'=>15, 'token'=>' ']);
//        return $this->_addAppIdToRunOne($data, 'serverintegralmall/goods/Goods/allGoodsList', $this->goodsValidate, $this->goodsLogic);
//    }
//
//    /*管理员下架某一个商品*/
//    public function soldOutOneGoods(): array
//    {
//        $data = $this->haveIssetReceiveData(['id'=>0, 'token'=>' ']);
//        return $this->_addAppIdToRunOne($data, 'serverintegralmall/goods/Goods/soldOutOneGoods', $this->goodsValidate, $this->goodsLogic);
//    }
//
//    /*管理员下架某一批商品*/
//    public function soldOutBatchGoods(): array
//    {
//        $data = $this->haveIssetReceiveData(['id'=>0, 'token'=>' ']);
//        return $this->_addAppIdToRunOne($data, 'serverintegralmall/goods/Goods/soldOutBatchGoods', $this->goodsValidate, $this->goodsLogic);
//    }
//
//    /*管理员删除商品*/
//    public function manageDelGoods(): array
//    {
//        $data = $this->haveIssetReceiveData(['id'=>0, 'token'=>' ']);
//        return $this->_addAppIdToRunOne($data, 'serverintegralmall/goods/Goods/manageDelGoods', $this->goodsValidate, $this->goodsLogic);
//    }
//
//    /*管理员批量删除商品*/
//    public function manageBatchDelGoods(): array
//    {
//        $data = $this->haveIssetReceiveData(['id'=>[], 'token'=>' ']);
//        return $this->_addAppIdToRunOne($data, 'serverintegralmall/goods/Goods/manageBatchDelGoods', $this->goodsValidate, $this->goodsLogic);
//    }

}